<?php

abstract class FP_Application_Subsystem {

    private static $subsystems = null;

    public static function Factory($pSubname, $pConfig, $pPrefix=null){

	$prefix = ($pPrefix) ? $pPrefix : 'FP_Application_Subsystem_';

	$subsystem_class = $prefix . ucfirst(to_camel_case($pSubname));
	$subsystem = new $subsystem_class();

	$subsystem->init($pConfig);

	if (self::$subsystems === null)
	    self::$subsystems = array();

	self::$subsystems[] = $pSubname;

	return $subsystem;
    }

    public static function Loaded($pSubname){

	return (in_array($pSubname, self::$subsystems));

    }

}

?>